<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center reportingPage_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub reportingPage_fd0_0'>
          <view class='flex flex-wrap align-center reportingPage_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  reportingPage_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='reportingPage_fd0_0_c1_c0'>{{$t('举报')}}</text>
          </view>
          <view class='flex flex-wrap align-center justify-end reportingPage_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout reportingPage_flex_1">
        <view class='flex flex-wrap align-center reportingPage_fd1_0'>
          <text class='reportingPage_fd1_0_c0'>{{$t('举报内容')}}</text>
        </view>
        <view class='flex flex-direction flex-wrap align-stretch reportingPage_fd1_1'>
          <benben-select-diy ref="showSelectPopup1698652656207" class-name='flex flex-wrap align-center flex'
            :items.sync="reportingType" v-model="reporting_id" default-type="aid" default-label="name"
            :allow-cancel='false' type="radio" :disabled='false'>
            <template v-for='(item,key0) in reportingType'>
              <view v-if="item.isSelected" class='flex align-center justify-center flex reportingPage_fd1_1_c0_c0'
                :key="key0" @tap="$refs.showSelectPopup1698652656207.tapHandle(key0)">
                <text class='flex-sub reportingPage_fd1_1_c0_c0_c0'>{{item.name}}</text>
              </view>
              <view v-else class='flex align-center justify-center flex reportingPage_fd1_1_c0_c1' :key="key0"
                @tap="$refs.showSelectPopup1698652656207.tapHandle(key0)">
                <text class='flex-sub reportingPage_fd1_1_c0_c1_c0'>{{item.name}}</text>
              </view>
            </template></benben-select-diy>
        </view>
        <text class='reportingPage_fd1_2'>{{$t('举报详情')}}</text>
        <view class='flex flex-direction flex-wrap align-stretch reportingPage_fd1_3'>
          <view class='flex flex-wrap reportingPage_fd1_3_c0'>
            <textarea class='flex reportingPage_input_fd1_3_c0' confirm-type="done" :placeholder="$t('请描述举报详情')"
              :maxlength="300" placeholder-style="color:#999;font-size:28rpx" v-model="reportingObj.contern" />

          </view>
          <view class='flex flex-direction flex-wrap align-stretch'>
            <text class='reportingPage_fd1_3_c1_c0'>{{$t('上传举报截图')}}</text>
            <benben-images-upload ref="benbenImagesUploadfd1_3_c1_c1" :img-list.sync="reportingObj.images"
              :img-ids.sync="reportingObj.images_id" :maxlength="9">
              <template #content="{ num, maxlength, isShow, imgList }">
                <view class="flex flex-wrap align-start flex reportingPage_fd1_3_c1_c1">

                  <view v-for="(image, index) in imgList" :key="index"
                    class='flex position-relative reportingPage_fd1_3_c1_c10'>
                    <text class='fu-iconfont2 position-absolute reportingPage_fd1_3_c1_c100'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.delImage(index)">&#xE8E7;</text>
                    <image class='reportingPage_fd1_3_c1_c101'
                      @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.previewImage(index)" mode="aspectFill"
                      :src='image'></image>
                  </view>

                  <image class='reportingPage_fd1_3_c1_c11'
                    @tap.stop="$refs.benbenImagesUploadfd1_3_c1_c1.manyChooseImage()" v-if="isShow" mode="aspectFit"
                    :src='STATIC_URL+"82.png"'></image>

                </view>
              </template>
            </benben-images-upload>
            <text class='reportingPage_fd1_3_c1_c2'>{{$t('我们将会优先处理有截图的举报信息哦~')}}</text>
          </view>
        </view>
      </view>


      <!---flex布局flex布局开始-->
      <view class="flex flex-direction flex-wrap align-center benben-flex-layout reportingPage_flex_2">
        <button class='reportingPage_fd2_0' @tap.stop="submitReportFunc()">{{$t('提交')}}</button>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "reportingType": [],
        "reporting_id": "",
        "reportingObj": {
          "contern": "",
          "images": [],
          "images_id": ""
        },
        "id": "",
        pub_type:''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        id,
        type
      } = options
      if (id !== undefined) this.id = id
      if (type !== undefined) this.pub_type = type
      this.getReportingFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //获取举报类型
      async getReportingFunc() {
        //请求方法
        //数据验证

        let datareportingType = await this.$api.get(global.apiUrls.post6551ebe92c40a, {

        });

        if (datareportingType.data.code != 1) {
          this.$message.info(datareportingType.data.msg);
          return
        }
        let inforeportingType = datareportingType.data;
        this.reportingType = inforeportingType.data

      },
      //提交举报
      async submitReportFunc() {
        if (!validate(this.reporting_id, 'require')) {
          this.$message.info('请选择举报类型');
          return false;
        }
        if (!validate(this.reportingObj.contern, 'require')) {
          this.$message.info('举报详情不能为空');
          return false;
        }
        //请求方法
        //数据验证

        let data6551ed4e79d4d = await this.$api.post(global.apiUrls.post6551ed4e79d4d, {
          house_id: this.id,
          pub_type:this.pub_type,
          content: this.reportingObj.contern,
          images: this.reportingObj.images_id,
          operationreporttype_id: this.reporting_id
        });

        if (data6551ed4e79d4d.data.code != 1) {
          this.$message.info(data6551ed4e79d4d.data.msg);
          return
        }



        this.$message.info(data6551ed4e79d4d.data.msg);
        setTimeout(() => {
          this.$urouter.navigateBack(1);
        }, 500)
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(255, 255, 255, 1);
    background-size: 100% auto;
  }

  .reportingPage_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .reportingPage_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333;
    line-height: 88rpx;
  }

  .reportingPage_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .reportingPage_fd0_0_c0 {
    width: 147rpx;
  }

  .reportingPage_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .reportingPage_flex_1 {
    background: #fff;
    background-size: 100% auto !important;
    position: relative;
  }

  .reportingPage_fd1_3_c1_c2 {
    color: #BFBFBF;
    font-size: 24rpx;
    font-weight: 400;
    line-height: 32rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .reportingPage_fd1_3_c1_c11 {
    width: 200rpx;
    height: 200rpx;
    margin: 0rpx 24rpx 24rpx 0rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .reportingPage_fd1_3_c1_c101 {
    width: 200rpx;
    height: 200rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .reportingPage_fd1_3_c1_c100 {
    top: 0rpx;
    right: 0rpx;
    z-index: 10;
    color: #ff5536;
  }

  .reportingPage_fd1_3_c1_c10 {
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .reportingPage_fd1_3_c1_c1 {
    padding: 24rpx 0rpx 0rpx 24rpx;
  }

  .reportingPage_fd1_3_c1_c0 {
    color: #1A1A1A;
    font-size: 32rpx;
    font-weight: 500;
    line-height: 42rpx;
    margin: 40rpx 0rpx 0rpx 32rpx;
  }

  .reportingPage_input_fd1_3_c0 {
    width: 100%;
    height: 300rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .reportingPage_fd1_3_c0 {
    background: rgba(246, 246, 246, 1);
    width: 686rpx;
    border-radius: 16rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
    padding: 24rpx;
    background-size: 100% auto;
  }

  .reportingPage_fd1_3 {
    margin: 0rpx 0rpx 32rpx 0rpx;
  }

  .reportingPage_fd1_2 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    line-height: 109rpx;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .reportingPage_fd1_1_c0_c1_c0 {
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    line-height: 28rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
  }

  .reportingPage_fd1_1_c0_c1 {
    background: rgba(246, 247, 249, 1);
    margin: 16rpx 16rpx 16rpx 16rpx;
    height: 64rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 206rpx;
    padding: 0rpx 10rpx 0rpx 10rpx;
  }

  .reportingPage_fd1_1_c0_c0_c0 {
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 28rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-align: center;
  }

  .reportingPage_fd1_1_c0_c0 {
    background: rgba(1, 129, 255, 1);
    margin: 16rpx 16rpx 16rpx 16rpx;
    height: 64rpx;
    border-radius: 8rpx 8rpx 8rpx 8rpx;
    width: 206rpx;
    padding: 0rpx 10rpx 0rpx 10rpx;
  }

  .reportingPage_fd1_1 {
    border-bottom: 10px solid rgba(246, 247, 248, 1);
    padding: 0rpx 16rpx 16rpx 16rpx;
  }

  .reportingPage_fd1_0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: #1A1A1A;
    margin: 0rpx 32rpx 0rpx 32rpx;
  }

  .reportingPage_fd1_0 {
    padding: 32rpx 0rpx 32rpx 0rpx;
  }

  .reportingPage_flex_2 {
    margin: 20rpx 0rpx 20rpx 0rpx;
  }

  .reportingPage_fd2_0 {
    background: #4781f5;
    border-radius: 44rpx;
    width: 686rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    position: fixed;
    bottom: calc(60rpx + var(--window-bottom));
  }
</style>
